import java.util.*;

/**
 * @author LKQ
 * @date 2022/3/18 9:06
 * @description
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int countGoodSubstrings(String s) {
        int ans = 0, n = s.length();
        if (n <= 2) {
            return ans;
        }
        char p = s.charAt(0), q = s.charAt(1), r;
        for (int i = 2; i < n; i++) {
            r = s.charAt(i);
            if (p != q && q != r && r != p) {
                ans++;
            }
            p = q;
            q = r;
        }
        return ans;
    }
}
